package com.ikas.ai.server.module.machine.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ikas.ai.server.module.machine.dao.MachineInfoDAO;
import com.ikas.ai.server.module.machine.model.po.MachineInfo;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

/**
 * 机组信息
 *
 * @author tang.xuandong
 * @version 1.0.0
 * @date 2023/5/9 16:50
 */
@Service
public class MachineInfoService extends ServiceImpl<MachineInfoDAO, MachineInfo> {

    /**
     * 通过机组编号获取机组信息
     *
     * @param machineNo 机组编号
     * @return MachineInfo
     */
    public MachineInfo getMachineInfo(String machineNo) {
        if (StringUtils.isBlank(machineNo)) {
            return null;
        }
        LambdaQueryWrapper<MachineInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(MachineInfo::getMachineNo, machineNo);
        return getOne(wrapper);
    }

}
